package RoomPanel;

import gui.HouseEditor;
import gui.MousePopupListener;
import gui.RoomPopupMenu;
import houseHold.Room;

import java.awt.Color;

import javax.swing.JPanel;
import javax.swing.border.LineBorder;

public class RoomPanel extends JPanel {

	private boolean marked = false;
	public int paint = 0;
	private int panelID;
	private Room room;

	public RoomPanel() {
		super();
		this.setBounds(1, 1, 50, 50);
		this.setBorder(new LineBorder(Color.red));
		setRoom(new Room());
		this.setOpaque(false);
		this.addComponentListener(new java.awt.event.ComponentAdapter() {
			@Override
			public void componentMoved(java.awt.event.ComponentEvent e) {

				Aproach.aproach(RoomPanel.this, HouseEditor.panels);
			}
		});

	}

	public void addPopUpMenu() {
		RoomPopupMenu pum = new RoomPopupMenu();
		pum.setId(panelID);
		MousePopupListener PopupListener = new MousePopupListener();
		PopupListener.setParent(this);
		PopupListener.setPopup(pum.getRoomPopUp());
		this.addMouseListener(PopupListener);
	}

	public int getPanelID() {
		return panelID;
	}

	public Room getRoom() {
		return room;
	}

	public boolean isMarked() {
		return marked;
	}

	public void setMarked(boolean marked) {
		this.marked = marked;
	}

	public void setPanelID(int id) {
		panelID = id;
		room.setID(id);
	}

	public void setRoom(Room room) {
		this.room = room;
	}

}
